<template>
  <div class="section" v-if="optimizedPrompt">
    <h2>3. 优化后的提示词</h2>
    <textarea
      :value="optimizedPrompt"
      rows="10"
      readonly
      class="optimized-output"
    ></textarea>
    <button @click="$emit('copy-to-clipboard')" class="copy-button">复制到剪贴板</button>
  </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue';

defineProps({
  optimizedPrompt: String,
});

defineEmits(['copy-to-clipboard']);
</script>

<style scoped>
.section {
  background-color: #ffffff;
  padding: 30px; /* Increased padding */
  border-radius: 12px; /* More rounded corners */
  margin-bottom: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Softer, more prominent shadow */
  border: 1px solid #f0f0f0; /* Subtle border */
}

h2 {
  color: #2c3e50; /* Darker blue for headings */
  margin-top: 0;
  margin-bottom: 20px; /* More space below heading */
  font-size: 1.8em; /* Larger heading */
  border-bottom: 2px solid #e0e0e0; /* Slightly darker separator */
  padding-bottom: 10px; /* More padding below separator */
  font-weight: 600; /* Semi-bold */
}

textarea.optimized-output {
  width: 100%;
  padding: 15px; /* More padding */
  margin-bottom: 20px; /* More margin below */
  border: 1px solid #c0c0c0; /* Solid border, consistent with inputs */
  border-radius: 8px; /* More rounded */
  font-size: 1.05em; /* Slightly larger font */
  resize: vertical;
  min-height: 150px; /* Taller textarea */
  box-sizing: border-box;
  background-color: #f8f8f8; /* Lighter background */
  color: #333;
  line-height: 1.6; /* Improved readability */
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Consistent font */
}

.copy-button {
  background-color: #28a745; /* Success green for copy button */
  color: white;
  padding: 12px 25px; /* More padding */
  border: none;
  border-radius: 8px; /* More rounded */
  cursor: pointer;
  font-size: 1.05em; /* Slightly larger font */
  transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  margin-top: 0; /* Remove top margin as gap handles spacing */
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2); /* Subtle shadow */
}

.copy-button:hover:not(:disabled) {
  background-color: #218838; /* Darker green on hover */
  transform: translateY(-1px); /* Slight lift */
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}
.copy-button:active {
  transform: translateY(0);
}
</style>
